<!DOCTYPE html>
<html>
<head>
<base href="${basePath}"/>
<meta name="renderer" content="webkit"/>
<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no"  />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>微信支付安全支付</title>
<script type="text/javascript" src="${basePath}js/jquery-1.8.3.min.js" ></script></head>
<body style="background:#f2efee;">
<script>
$(function(){
	wxPay();
	function onBridgeReady(){
   WeixinJSBridge.invoke(
       'getBrandWCPayRequest', {
           "appId" : "${(wxjsVo.appId)!''}",                  //公众号名称，由商户传入     
           "timeStamp":"${(wxjsVo.timeStamp)!''}",                        //时间戳，自1970年以来的秒数     
           "nonceStr" : "${(wxjsVo.nonceStr)!''}", //随机串     
           "package" : "${(wxjsVo.prepay_id)!''}",     
           "signType" : "MD5",         //微信签名方式:     
           "paySign" : "${(wxjsVo.paySign)!''}" //微信签名 
       },
       function(res){ 
       	   // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。    
           if(res.err_msg == "get_brand_wcpay_request:ok" ) {
           	  document.location.href="${basePath}pay/WxJsOrder_userPayReturnUrl?authOrderId=${(orderNumber)!''}";
           }else{
           	  document.location.href="${basePath}pay/WxJsOrder_userPayFail?authOrderId=${(orderNumber)!''}";
           }
       }
   ); 
}
function wxPay(){
	if (typeof WeixinJSBridge == "undefined"){
	   if( document.addEventListener ){
	       document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
	   }else if (document.attachEvent){
	       document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
	       document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
	   }
	}else{
	   onBridgeReady();
	} 
}
});
</script>
</body>
</html>
